package ooday03;

public class RefArrayDemo {

    public static void main(String[] args) {

        Dog[] dogs = new Dog[10];
        Chick[] chicks = new Chick[9];
        Fish[] fish = new Fish[8];

        dogs[0] = new Dog("小黑", 2, "黑");
        dogs[1] = new Dog("小白", 1, "白");
        dogs[2] = new Dog("小灰", 3, "灰");

        System.out.println(dogs[0].name);
        dogs[1].swim();
        dogs[2].eat();

        for (int i = 0; i < 3; i++){
            System.out.println(dogs[i].color);
            dogs[i].lookHome();
        }

        chicks[0] = new Chick("Alice",4,"blue");
        chicks[1] = new Chick("zero",8,"green");
        chicks[2] = new Chick("bob",5,"black");

        for (int i = 0; i < 3; i++){
            chicks[i].layEgg();
        }

    }

}
